﻿using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Validation.Configuration;
using System;

namespace AsNum.Common.EntLib.Validation.Adapters {
    public class ObjectClientAdapter : BaseClientAdapter<ObjectValidatorData> {

        public override RuleTypes RuleType {
            get {
                return RuleTypes.Object;
            }
        }

        public ObjectClientAdapter(ObjectValidatorData data , Dictionary<string , Tuple<string , string>> map , bool isSub = false)
            : base ( data , map , isSub ) {

        }

        public Dictionary<string , List<BaseClientAdapter>> GetSubAdapters(string typeName) {
            var type = ValidationHelper.FindRulesetsByName ( this.ValidatorData.TargetRuleset , typeName );
            if ( type != null ) {
                return ValidationHelper.GetRuleGroups ( type , this.ValidatorData.TargetRuleset , this.Map );
            }
            return null;
        }
    }
}
